<template>
  <div>
    <ul v-for="(item, index) in arr" :key="index">
      <li>{{ item }}</li>
    </ul>
    <button @click="reversal">反转</button>
    <!-- @click="cut" -->
    <button @click="cut">截取</button>
     <!-- @click="chenge" -->
    <button @click="change">更改</button>
  </div>
</template>

<script>
export default {
  name: 'BrandManagementApp',

  data () {
    return {
      arr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
    }
  },

  mounted () {},

  methods: {
  // 点击反转
  reversal() {
 this.arr.reverse()
  },
  // 点击截取
  cut() {
    // 从下标1开始截到下标8
    this.arr = this.arr.slice(1,8)
  },
  // 点击更改
change(){
  // $set 用于更新数组数据
  this.$set(this.arr, 3, 22);
}
  }
}
</script>

<style lang="scss" scoped></style>
